//
//  CALayer+Shake.m
//  GestureTest
//
//  Created by 迷你金服 on 2017/3/10.
//  Copyright © 2017年 迷你金服. All rights reserved.
//

#import "CALayer+Shake.h"

@implementation CALayer (Shake)
//文字摇动效果
- (void)shake {
    CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"transform.translation.x"];
    CGFloat offset = 16.f;
    animation.values = @[@(-offset),@(0),@(offset),@(0),@(-offset),@(0),@(offset),@(0)];
    animation.duration = 0.1f;
    animation.repeatCount = 2;
    animation.removedOnCompletion = YES;
    [self addAnimation:animation forKey:@"shake"];

}
@end
